<template>
  <div>
    <div>
      <el-button @click="colse">^—返回—^</el-button>
      <span style="margin-left: 500px;font-size: 30px">安全日志</span>
      <el-divider content-position="right"></el-divider>
      <div style="width: 1300px">
        <span style="font-size:20px;color: red">基本信息</span>
        <el-form ref="form" label-width="200px" :model="SecuritylogForm">
          <el-row>
            <el-col :span="12">
              <el-form-item label="日期:">
                <el-col :span="11">
                  <el-date-picker
                    type="date"
                    placeholder="选择日期"
                    style="width: 450px;"
                    value-format="yyyy-MM-dd"
                    v-model="SecuritylogForm.updateDate"
                  ></el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="日志编号:">
                <el-input v-model="SecuritylogForm.id"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="项目名称:">
                <el-select v-model="SecuritylogForm.pid" placeholder="项目名称" style="width: 450px;">
                  <el-option label="--请选择--" value></el-option>
                  <el-option
                    v-for="item in projectname"
                    :key="item.id"
                    :label="item.projectName"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="施工部位:">
                <el-input v-model="SecuritylogForm.workPart"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="部门:">
                <el-select v-model="SecuritylogForm.deptId" style="width: 450px;">
                  <el-option label="--请选择--" value></el-option>
                  <el-option
                    v-for="item in deptname"
                    :key="item.id"
                    :label="item.deptname"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="填写人:">
                <el-select v-model="SecuritylogForm.fillUser" style="width: 450px;">
                  <el-option label="--请选择--" value></el-option>
                  <el-option
                    v-for="item in username"
                    :key="item.id"
                    :label="item.userRealname"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="当日施工安全情况:">
              <el-input type="textarea" v-model="SecuritylogForm.securitySituation"></el-input>
            </el-form-item>
          </el-row>
          <multi-file-upload
            style="font-size:20px;color: red"
            title="附件"
            action="http://localhost/uploads"
            :params="{folder: 'subTenderPlan'}"
            :headers="{token: token}"
            :show-button="false"
            :parent-file-list="fileList"
          ></multi-file-upload>

          <el-form-item>
            <el-button type="primary" style="margin-left: 1000px" @click="updatesecuritylog">确认更改</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: [
    "getsecuritylogid",
    "worklog",
    "projectname",
    "username",
    "deptname",
    "securitylogs"
  ], //接收父组件传递的数据
  data() {
    return {
      fileList: JSON.parse(JSON.stringify(this.securitylogs)),
      SecuritylogForm: JSON.parse(JSON.stringify(this.getsecuritylogid)), //避免子组件更新了父组件的数据状态
      worklo: JSON.parse(JSON.stringify(this.worklog))
    };
  },
  methods: {
    colse() {
      this.$emit("colse", (this.worklo = 1));
    },
    updatesecuritylog() {
      this.$emit("update", this.SecuritylogForm);
    }
  },
  created() {},
  computed: {
    token: {
      get() {
        return this.$store.state.token;
      }
    },
    checkRoute() {
      return Object.keys(this.$route.params).length != 0;
    }
  }
};
</script>

<style>
</style>